CMAKE_MINIMUM_REQUIRED (VERSION 3.7.2)

IF(NOT CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE "Release")
ENDIF()

IF(NOT WIN32)
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
ENDIF(NOT WIN32)

ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_UNICODE)
ADD_DEFINITIONS(-DIFCQUERY_STATIC_LIB)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/IfcPlusPlus/Debug)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/IfcPlusPlus/${CMAKE_BUILD_TYPE})

ADD_EXECUTABLE(LoadFileExample 
    ${IFCPP_SOURCE_DIR}/examples/LoadFileExample/src/main.cpp
)

set_target_properties(LoadFileExample PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(LoadFileExample PROPERTIES CXX_STANDARD 17)

TARGET_LINK_LIBRARIES(LoadFileExample optimized IfcPlusPlus debug IfcPlusPlusd)

TARGET_INCLUDE_DIRECTORIES(LoadFileExample
    PRIVATE
	${CMAKE_CURRENT_SOURCE_DIR}/src
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/ifcpp/IFC4X3/include
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/glm
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/Carve/include
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/Carve/src
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/Carve/src/include
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/Carve/src/common
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/Carve/build/src
	${IFCPP_SOURCE_DIR}/IfcPlusPlus/src/external/glm
)
		
INSTALL(
    TARGETS LoadFileExample
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION bin
    ARCHIVE DESTINATION lib
)
